platform change is called from gtk_widget_set_focusable
which is likely to be called early on in init(). We don't
want to create an AT context that early if we can help
it, e.g. since it makes it impossible to override the
accessible-role with a construct property.
gtk_accessible_platform_changed (GtkAccessible *self,
GtkAccessiblePlatformChange change)
{
- GtkATContext *context = gtk_accessible_get_at_context (self);
+ GtkATContext *context;
+
+ if (GTK_IS_WIDGET (self) &&
+ gtk_widget_get_root (GTK_WIDGET (self)) == NULL)
+ return;
+
+ context = gtk_accessible_get_at_context (self);
/* propagate changes up from ignored widgets */
if (gtk_accessible_get_accessible_role (self) == GTK_ACCESSIBLE_ROLE_NONE)
{
- if (gtk_widget_get_parent (GTK_WIDGET (self)) == NULL)
- return;
-
context = gtk_accessible_get_at_context (GTK_ACCESSIBLE (gtk_widget_get_parent (GTK_WIDGET (self))));
}